Étagère
A dynamic texture atlas allocator using the shelf packing algorithm.
Motivation
The ability to dynamically batch textures together is important for some graphics rendering scenarios (for example WebRender).
The shelf packing algorithm works very well when there is a high number of items with similar sizes, for example for dynamic glyph atlases.
See also guillotière, another dynamic atlas allocator based on a different algorithm, with different packing and performance characteristics.
Example
use *;
let mut atlas = new;
let a = atlas.allocate.unwrap;
let b = atlas.allocate.unwrap;
atlas.deallocate;
let c = atlas.allocate.unwrap;
assert_eq!;
atlas.deallocate;
atlas.deallocate;
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.